﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CalculationCore.UX;

namespace CalculationCore
{
    class Program
    {
        static void Main(string[] args)
        {
            BinaryTree bt = new BinaryTree("Zdravo"), btl = new BinaryTree("left"), btr = new BinaryTree("right");
            List<BinaryTree> blist = new List<BinaryTree>();
            Function t = new Function("sin(x^2)+2)");
            Console.WriteLine("Fja je: " + t.ToString());
            Console.WriteLine("Vrednost u tacki 0.3 je: " + t.Value(0.3));
            Console.WriteLine("Izvodna fja je: " + t.Derive());
            Matrix a = new Matrix(5, 2, 3);
            Matrix b = new Matrix(2, 4, 5);
            Matrix d = new Matrix(2, 4, 2);
            Matrix g = new Matrix(3, 3, 3);
            Matrix h = new Matrix(5, 4, 9);
            Matrix p = new Matrix(2, 4, 7);
            Matrix f = new Matrix();
            Matrix c = new Matrix();
            Console.WriteLine(b);
            Console.WriteLine("   +");
            Console.WriteLine(d);
            Console.WriteLine("   =");
            Console.WriteLine(f = b + d);
            Console.ReadKey();
            Console.WriteLine(a);
            Console.WriteLine("   *");
            Console.WriteLine(b);
            Console.WriteLine("   =");
            Console.WriteLine(a.Multiplicate(b));
            Console.ReadKey();
            Console.WriteLine("Unesi matricu");
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    g[i][j] = Convert.ToInt32(Console.ReadLine())
                        ;
                }
            }

            Console.WriteLine("Uneta je matrica g=");
            Console.WriteLine(g);
            Console.ReadKey();
            Console.WriteLine("g^-1 =");
            Console.WriteLine(g.Inverse());
            Console.WriteLine(g.Multiplicate(g.Inverse()));
            Console.WriteLine("g' =");
            Console.WriteLine(g.Transpose());
            Console.ReadKey();
            Console.WriteLine("diag(g) =");
            Console.WriteLine(g.Diag());
            Console.ReadKey();
            Console.WriteLine("Sum(g) =");
            Console.WriteLine(g.Sum());
            Console.ReadKey();
            Console.WriteLine(g);
            Console.WriteLine("Beskonacna norma od g je(to je zapravo najveca apsolutna vrednost od brojeva u matrici :))");
            Console.WriteLine(g.NormMax());
            Console.ReadKey();
            Console.WriteLine("Determinanta je: " + g.Determinant());
            Console.ReadKey();
            Console.WriteLine(g);
            Console.WriteLine("Zameni prvu i drugu vrstu u g:");
            g.ExchangeRows(0, 1);
            Console.WriteLine(g);
            Console.ReadKey();
            Console.WriteLine("A sada jos zameni prvu i trecu kolonu");
            g.ExchangeColumns(0, 2);
            Console.WriteLine(g);
            Console.ReadKey();
            Console.WriteLine("g[5][5]=7 ");
            g.Setf(5, 5, (float)7);
            Console.WriteLine(g);
            Console.ReadKey();
            Console.WriteLine("[3:7]");
            Console.WriteLine(Matrix.ColonOperator(3, 7));
            Console.ReadKey();
            Console.WriteLine("[-8.23:2:4]");
            Console.WriteLine(Matrix.ColonOperator((float)-8.23, (float)2, (float)4));
            Console.ReadKey();
            Console.WriteLine(a);
            Console.WriteLine("Spoji po vrstama sa");
            Console.WriteLine(h);
            Console.WriteLine("   =");
            Console.WriteLine(a.ConcateRows(h));
            Console.ReadKey();
            Console.WriteLine(h);
            Console.WriteLine("Spoji po kolonama sa");
            Console.WriteLine(p);
            Console.WriteLine("   =");
            Console.WriteLine(h.ConcateColumns(p));
            Console.ReadKey();
            Console.WriteLine("Ajmo pes ole!!!!!!!!");
            Console.ReadKey();

        }
    }
}
